package com.base.ui.other
{
	import com.base.util.Utils;
	
	import mx.collections.ArrayCollection;
	import mx.controls.ComboBox;
	
	public class NComboBox extends ComboBox
	{
		public function NComboBox()
		{
			super();
		}
		
		/**
		 * 设置选中项,从数据源中data字段
		 * @param data
		 * @return 
		 */		
		public function set selectedItemByData( data:* ):void{
			var item:Object = Utils.findDataByArray( ArrayCollection(dataProvider) , data );
			if( item ) selectedItem = item;
		}
		
		/**
		 * 获取选中项data数据
		 * @return 
		 */		
		public function get selectedItemByData():* {
			return selectedItem ? selectedItem["data"] : null;
		}
	}
}